package com.zis.system.client;

import com.zis.starter.core.ResponseEntity;
import com.zis.starter.core.SearchParams;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zis.system.model.Sys;

import java.util.Map;

@FeignClient("sys-server")
public interface SysClient {

    @RequestMapping(value = "/sys/list", method = RequestMethod.POST)
    PageQuery<Sys> findByPage(@RequestBody SearchParams params) throws Exception;

    @RequestMapping(value = "/sys/condition", method = RequestMethod.POST)
    ResponseEntity findByCondition(@RequestBody Map params) throws Exception;

    @RequestMapping(value = "/sys/save", method = RequestMethod.POST)
    ResponseEntity insert(@RequestBody Sys model) throws Exception;

    @RequestMapping(value = "/sys/update", method = RequestMethod.POST)
    ResponseEntity update(@RequestBody Sys model) throws Exception;

    @RequestMapping(value = "/sys/delete/{id}", method = RequestMethod.GET)
    ResponseEntity delete(@PathVariable("id") String id) throws Exception;

    @RequestMapping(value = "/sys/select/{id}", method = RequestMethod.GET)
    ResponseEntity selectById(@PathVariable("id") String id) throws Exception;

    @RequestMapping(value = "/sys/all", method = RequestMethod.GET)
    ResponseEntity findAllToJson() throws Exception;
}
